package com.qjc.controller;

import com.qjc.entity.Order;
import com.qjc.mapper.OrderMapper;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class OrderController {

    @Resource
    OrderMapper orderMapper;

    @RequestMapping(value = "/order", method = RequestMethod.GET, produces = "application/json")
    public String order(String userId, String commodityCode, int orderCount) {

        Order order = new Order();
        order.setUserId(userId);
        order.setCommodityCode(commodityCode);
        order.setCount(orderCount);
        order.setMoney(10);
        orderMapper.insertSelective(order);

        return "SUCCESS";
    }

}
